<?php
class Zend_View_Helper_GetModule extends Zend_View_Helper_Abstract
{
    
    public function getModule()
    {
       $args = func_get_args();
       $name = array_shift($args);
       if(method_exists($this,$name)){
			return call_user_func_array(
	            array($this, $name),
	            $args
        	);
		}else{
			return '<div class="main-area"><div class="area-div">'.$name.'</div></div>';
		}
    }
    protected function news()
    {
    	$article = new News();
    	
    	//if(count($this->view->articleList)>0){
    		return $this->moduleRender("modules/news.phtml");
    	//}
    }
    
   
    
 	protected function newsclass()
    {
    	return $this->moduleRender("modules/newsclass.phtml");
    }
    
    protected function score()
    {
    	return $this->view->render("modules/score.phtml");
    }
    
    protected function info()
    {
    	
    	return $this->moduleRender("modules/info.phtml");    	
    }
    
    protected function about()
    {
    	
    	$member = new Member();
    	$category=new Category();
    	$area=new Area();
    	
    	$this->view->myInfo=$company= $member->getMemberInfoById($this->view->uid);
    	$cid=$company[0]['cid'];
    	$aid=$company[0]['area'];
    	$this->view->category=$category->getPathName($cid);
    	$this->view->area=$area->getPathName($aid);
    	
    	return $this->moduleRender("modules/about.phtml");    
    }
    
    protected function guestbook()
    {
		return $this->moduleRender("modules/guestbook.phtml");
    }
    
    protected function link()
    {
    	$link = new Link();
    	
    	$where="status=1 AND uid=".$this->view->uid;
    	$order='id DESC';
    	$this->view->linkList = $link->getAjaxData($where);
    	
    	if(count($this->view->linkList)>0){
			return $this->moduleRender("modules/link.phtml");
    	}
    }
    
	
    protected function friend()
    {
    	
    	return $this->moduleRender('modules/friend.phtml');
    }
    
    protected function favor()
    {
    	
    	return $this->moduleRender('modules/favor.phtml');
    }
    
    protected function member()
    {
    	
		return $this->moduleRender('modules/member.phtml');
    }
    
    protected function sale()
    {
    	$product = new Product();
    	$sign=1;
    	$where="sign=$sign and p.status=1 AND p.uid=".$this->view->uid;
    	$order='p.id DESC';
    	$this->view->saleList = $product->getAjaxData($where,$order,8);
    	//if(count($this->view->saleList)>0){
        	return $this->moduleRender("modules/sale.phtml");
    	//}
    }
    
 	protected function product()
    {
    	$product = new Product();
    	$where="p.status=1 AND p.uid=".$this->view->uid;
    	$order='p.id DESC';
    	$this->view->productList = $product->getAjaxData($where,$order,8);
    	//if(count($this->view->productList)>0){
        	return $this->moduleRender("modules/product.phtml");
    	//}
    }
    
   
    
 	
    
	public function cooperation()
    {
    	$product = new Product();
    	$sign=1;
    	$where="sign=$sign and p.status=1 AND p.uid=".$this->view->uid;
    	$order='p.id DESC';
    	$this->view->cooperationList = $product->getAjaxData($where,$order,8);
    	//if(count($this->view->cooperationList)>0){
    		return $this->moduleRender('modules/cooperation.phtml');
    	//}
    }
   
    protected function moduleRender($script)
    {
    	
    	return $this->view->render($script);
    }
}
